const newsServ = require('../service/newsServ.js')

const newsCtrl = {
  newslist: async (ctx) => {
    const res = await newsServ.newslistServ()
    ctx.body = {
      code: 0,
      msg: 'success',
      data: res
    }
  },
  webnewsList: async (ctx) => {
    const data = ctx.request.body
    const res = await newsServ.webnewsListServ(data)
    ctx.body = {
      code: 0,
      msg: 'success',
      data: res
    }
  },
  addNews : async (ctx) =>{
    const data = ctx.request.body
     await newsServ.addNewsServ(data)
    ctx.body = {
      code: 0,
      msg: 'success',
    }
  },
  deletenews: async (ctx) =>{
    const data = ctx.request.body
    await newsServ.deletenewsServ(data)
    ctx.body = {
      code: 0,
      msg: 'success',
    }
  },
  selectNewsDetailMod: async (ctx) =>{
    const data = ctx.request.body
    const res = await newsServ.selectNewsDetailServ(data)
    ctx.body = {
      code: 0,
      msg: 'success',
      data : res
    }
  }

}

module.exports = newsCtrl